import request from '@/utils/request'

request.baseURL = 'http://localhost:9092'

export const getSupplierListByQueryinfService = (queryinf) => {
  return request.get('/supplier/getSupplierListByQueryinf', {
    params: { queryinf: queryinf }
  })
}

export const delSupplierByIdService = (id) => {
  return request.get('/supplier/delSupplierById', {
    params: { id: id }
  })
}

export const getProductListBySupplierIdService = (sId) => {
  return request.get('/product/getProductListBySupplierId', {
    params: { sId: sId }
  })
}

export const getProductListBySupplierIdQueryinfService = (sId, queryiInf) => {
  return request.get('/product/getProductListBySupplierIdQueryinf', {
    params: { sId: sId, queryiInf: queryiInf }
  })
}

export const delSupplierProductByIdService = (sId, pId) => {
  return request.get('/supplier/delSupplierProductById', {
    params: { sId: sId, pId: pId }
  })
}

export const addSupplierService = (params) => {
  return request.post('/supplier/addSupplier', params)
}

export const editSupplierByIdService = (params) => {
  return request.post('/supplier/editSupplierById', params)
}

export const addSupplierProductService = (sId, pId) => {
  return request.get('/supplier/addSupplierProduct', {
    params: { sId: sId, pId: pId }
  })
}

export const getProductListByQueryinfService = (queryInf) => {
  return request.get('/product/getProductListByQueryinf', {
    params: { queryInf: queryInf }
  })
}
